<#compress>
    <#assign actionname>${(action=='create')?string('新建','编辑')}</#assign>
    <@override name="title">${actionname}品牌</@override>
    <@override name="viewcss">
    <link href="${ctx}/static/admin/css/pages/portfolio.css" rel="stylesheet" type="text/css"/>
    <link href="${ctx}/static/scripts/plugins/kindeditor/themes/simple/simple.css" rel="stylesheet" type="text/css"/>
    </@override>
    <@override name="viewbody">
    <div class="row">
        <div class="col-md-12">
            <h3 class="page-title">
            ${actionname}品牌
                <small>${actionname}品牌.</small>
            </h3>
            <ul class="page-breadcrumb breadcrumb">
                <li>
                    <i class="fa fa-home"></i>
                    <a href="${ctx}/admin/home">
                        首页
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="${ctx}/admin/brand">
                        品牌管理
                    </a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">${actionname}品牌 </a>
                </li>
            </ul>
        </div>
    </div>

    <div class="portlet box blue">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i>品牌信息
        </div>
    </div>
    <div class="portlet-body form">
        <form class="form-horizontal form-bordered form-row-stripped" action="${ctx}/admin/brand/save" role="form" id="brandForm" method="post">
            <input name="brand.id" type="hidden" value="${brand.id!}"/>

            <div class="form-body">
                <div class="form-group">
                    <label class="col-md-3 control-label" for="brandName">中文名称:<span class="required">*</span></label>

                    <div class="col-md-9">
                        <input type="text" class="required form-control" placeholder="品牌中文名"
                               name="brand.name" id="brandName" value="${brand.name!}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3" for="brand_e_name">英文名称:<span class="required">*</span></label>

                    <div class="col-md-9">
                        <input type="text" class="required form-control" placeholder="品牌英文名"
                               name="brand.e_name" id="brand_e_name" value="${brand.e_name!}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="brand_floor">所在楼层:<span class="required">*</span></label>

                    <div class="col-md-9">
                        <select data-placeholder="选择楼层" name="brand.floor" id="brand_floor"
                                class="required form-control input-medium select2me">
                            <option value=""></option>
                            <#if floors??>
                                <#list floors as item>
                                    <option value="${item.id}"
                                            <#if brand.floor?? && brand.floor == item.id>selected="selected"</#if> >${item.name}</option>
                                </#list>
                            </#if>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="brandFormat">所属业态: <span class="required">*</span></label>

                    <div class="col-md-9">
                        <div class="row">
                            <div class="col-md-9">
                                <select data-placeholder="业态选择" name="brand.format_name" id="brandFormat"
                                        class="required form-control input-medium select2me">
                                    <option value=""></option>
                                    <#if formats??>
                                        <#list formats as item>
                                            <option value="${item.id},${item.name}"
                                                    <#if brand.format?? && brand.format == item.id>selected="selected"</#if> >${item.name}</option>
                                        </#list>
                                    </#if>
                                </select>
                            </div>

                        </div>

                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="brand_contact">联系方式: </label>

                    <div class="col-md-9">
                        <input type="text" class="form-control" placeholder="联系方式"
                               name="brand.contact" id="brand_contact" value="${brand.contact!}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="brand_location">店铺位置: </label>

                    <div class="col-md-9">
                        <input type="text" class="form-control" placeholder="店铺位置"
                               name="brand.location" id="brand_location" value="${brand.location!}">
                    </div>
                </div>
                <div class="form-group">

                    <label class="col-md-3 control-label">店铺LOGO：</label>

                    <div class="col-md-9 single_pic">
                        <input type="hidden" id="picture" name="brand.logo" value="${brand.logo!}">
                        <input id="logoAttachmentUpload" type="file" class="btn">

                        <div class="picture" id="show_picture" style="display: ${(brand.logo??)?string('display','none')};">
                            <a href="<#if brand.logo??>${ctx}/${brand.logo}</#if>"
                               class="thumbnail fancybox-button" id="box_picture" data-rel="logo">
                                <img src="<#if brand.logo??>${ctx}/${brand.logo?replace('.','.thumbnail.')}</#if>"
                                     alt=""/>
                            </a>
                            <a href="#" class="action" data-hook="remove_picture" data-target="#picture"
                               data-data="${brand.logo!}"><i class="fa fa-times"></i> </a>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="description">品牌描述:</label>

                    <div class="col-md-9">
                        <textarea rows="3" cols="4" id="description" class="limited form-control"
                                  name="brand.description"
                                  placeholder="请输入品牌描述">${brand.description!}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="brand_mall">所属购物中心: </label>

                    <div class="col-md-9">
                        <select data-placeholder="选择购物中心" name="brand.mall" id="brand_mall"
                                class="required form-control select2me">
                            <#if mallblock??>
                                <#list mallblock as mb>
                                    <option value="${mb.id}"
                                            <#if brand.mall?? && brand.mall == mb.id>selected="selected"</#if> >${mb.name}
                                        --${mb.blockname}</option>
                                </#list>
                            </#if>
                        </select>
                        <span class="help-block" id="malldesc">购物中心--所属集团.</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label" for="mo_prictures">&nbsp; </label>

                    <div class="col-md-9">
                        <p class="form-control-static">
                            <input id="prictureAttachmentUpload" type="file" class="btn">
                        </p>
                        <input type="hidden" id="mo_prictures" name="brand.picture" value="${brand.picture!}">
                    </div>
                </div>


                <div class="row">
                    <div class="col-md-12 picture_grid" id="pricture-grid">
                        <#if pics??>
                            <#list pics as pic>
                                <#assign new_line = ((pic_index+1) % 4 == 0)/>
                                <#if new_line>
                                <div class="row margin-top-10">
                                </#if>
                                <div class="col-sm-6 col-md-3 picture">
                                    <a href="${ctx}${pic!}" class="thumbnail fancybox-button" data-rel="fancybox-button">
                                        <img class="" src="${ctx}${pic?replace('.','.thumbnail.')}" alt="">
                                    </a>
                                    <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
                                       data-data="${pic!}"><i class="fa fa-times"></i> </a>
                                </div>
                                <#if new_line>
                                </div>
                                </#if>
                            </#list>
                        </#if>
                    </div>
                </div>
            </div>


            <div class="form-actions text-right">

                <a class="btn default yellow-stripe" href="${ctx}/admin/brand"><i
                        class="fa fa-arrow-circle-o-left"></i> 返回</a>
                <input type="submit" value="保存" class="btn btn-primary">
            </div>

        </form>
    </div>

    <script id="showpics-template" type="text/x-handlebars-template">
        <div class="col-sm-6 col-md-3 picture">
            <a href="{{ctx}}{{preview}}" class="thumbnail fancybox-button" data-rel="fancybox-button">
                <img class="" src="{{ctx}}{{data}}" alt="">
            </a>

            <a href="#" class="action" data-hook="remove_picture" data-target="#mo_prictures"
               data-data="{{preview}}"><i class="fa fa-times"></i> </a>
        </div>
    </script>

    </@override>

    <@override name="viewparams">
    g.preview_template = '#showpics-template';
    </@override>

    <@override name="viewmodule">brand_item</@override>
    <@extends name="../_basic/main.ftl"></@extends>
</#compress>